import 'package:flutter/services.dart';
import 'package:palyer/app/core/core.dart';
import 'package:palyer/app/core/values/colors.dart';

/// @Author: leijingxing
/// @Date: 2023-3-17
/// @LastEditTime: 2023-3-17
/// @LastEditors: leijingxing
/// @Description: 自定义appbar
class CustomAppBar extends AppBar {
  CustomAppBar({
    Key? key,
    Widget? leading,
    Widget? title,
    String? titleText,
    List<Widget>? actions,
    double? elevation,
    Color? shadowColor,
    Color? foregroundColor,
    Color? backgroundColor,
    bool centerTitle = false,
    bool automaticallyImplyLeading = true,
    VoidCallback? onBack,
    SystemUiOverlayStyle? systemOverlayStyle,
  }) : super(
          key: key,
          leading: leading ??
             ( automaticallyImplyLeading ?
              IconButton(
                icon: const Icon(
                  Icons.arrow_back,
                  color: AppColors.primary_color2,
                  size: 20,
                ),
                onPressed: () => {Get.back()},
              ) : null ),
          title: title ??
              (titleText != null
                  ? Text(
                      titleText,
                    )
                  : null),
          actions: actions,
          elevation: elevation ?? 2,
          backgroundColor: backgroundColor,
          foregroundColor: foregroundColor,
          // shadowColor: shadowColor ?? AppShadows.appbarShadow.color,
          centerTitle: centerTitle,
          titleSpacing: 0,
          systemOverlayStyle: systemOverlayStyle,
        );
}
